/*
 * Created on 2006-6-27
 */
package entity;

public class Velocity {
	double vx;

	double vy;

	static double sig = 1; 
	
	public Velocity(double vx, double vy) {
		this.vx = vx;
		this.vy = vy;
	}
	
	public double getVx() {
		return this.vx;
	}

	public double getVy() {
		return this.vy;
	}

	public String toString() {
		return "(" + this.vx + "," + this.vy + ")";
	}

	public double oneValueSpeed() {
		return Math.sqrt(Math.pow(this.vx, 2) + Math.pow(this.vy, 2));
	}

	//if the speed change is more than $sig$
	//the change is significant
	public boolean sameWith(Velocity as) {
		double delta = Math.abs(this.vx - as.vx)
				+ Math.abs(this.vy - as.vy);
		// System.out.println(delta);
		if (delta < sig) {
			return true;
		} else {
			return false;
		}
	}


}
